<template>
    <ul class="flex items-center my-[16px] h-[24px]">
        <li v-for="item in breadcrumbList">
            <a :href="item.path" class="text-[16px] text-666">{{ item.name }}</a>
            <img :src="path.src" class="w-[8px] h-[14.4px] inline-block mx-[10px] mb-[3px]" alt="">
        </li>
    </ul>
</template>
<script setup>
import { ref } from 'vue'

import path from '@assets/breadcrumb/path.png'
// encapsulationResourcesDetail 球栅列阵
const breadcrumbList = ref([]);
try {
    if (window.location.pathname.includes('/programme')) {
        breadcrumbList.value =
            [
                {
                    name: "首页",
                    path: "/"
                },
                {
                    name: "应用方案",
                    path: '/programme'
                }]
    }
    if (window.location.pathname.includes('/componentPackagingLibrary')) {
        breadcrumbList.value =
            [
                {
                    name: "首页",
                    path: "/"
                },
                {
                    name: "设计资源",
                    path: '/designResources'
                },
                {
                    name: "元器件封装库",
                    path: "/componentPackagingLibrary"
                }
            ]
    }
    if (window.location.pathname.includes('/productDetailInfoData')) {
        breadcrumbList.value =
            [
                {
                    name: "首页",
                    path: "/"
                },
                {
                    name: "产品中心",
                    path: "/plan"
                },
                {
                    name: "负载点电源",
                    path: '/productDetail'
                },
                {
                    name: "电源转换器",
                    path: '/productDetailTableData'
                },
                {
                    name: "EZ8620",
                    path: '/productDetailInfoData'
                },
            ]
    }

    else if (window.location.pathname.includes('/productDetailTableData')) {
        breadcrumbList.value =
            [
                {
                    name: "首页",
                    path: "/"
                },
                {
                    name: "产品中心",
                    path: "/plan"
                },
                {
                    name: "负载点电源",
                    path: '/productDetail'
                },
                {
                    name: "电源转换器",
                    path: '/productDetailTableData'
                }
            ]
    }
    else if (window.location.pathname.includes('/productDetail')) {
        breadcrumbList.value =
            [
                {
                    name: "首页",
                    path: "/"
                },
                {
                    name: "产品中心",
                    path: "/plan"
                },

                {
                    name: "负载点电源",
                    path: '/productDetail'
                }
            ]
    }
    else if (window.location.pathname.includes('/plan')) {
        breadcrumbList.value =
            [
                {
                    name: "首页",
                    path: "/"
                },
                {
                    name: "产品中心",
                    path: '/plan'
                }
            ]
    }

    else if (window.location.pathname.includes('/automotiveElectronics')) {
        breadcrumbList.value =
            [
                {
                    name: "首页",
                    path: "/"
                },
                {
                    name: "应用方案",
                    path: '/programme'
                },
                {
                    name: "汽车电子",
                    path: "/automotiveElectronics"
                }
            ]
    }
    else if (window.location.pathname.includes('/productEvaluationBoard')) {
        breadcrumbList.value =
            [
                {
                    name: "首页",
                    path: "/"
                },
                {
                    name: "设计资源",
                    path: '/designResources'
                },
                {
                    name: "评估板",
                    path: "/productEvaluationBoard"
                }
            ]
    }
    else if (window.location.pathname.includes('/productEvaluationBoard')) {
        breadcrumbList.value =
            [
                {
                    name: "首页",
                    path: "/"
                },
                {
                    name: "设计资源",
                    path: '/designResources'
                },
                {
                    name: "评估板",
                    path: "/productEvaluationBoard"
                }
            ]
    }

    else if (window.location.pathname.includes('/encapsulationResourcesDetail')) {
        breadcrumbList.value =
            [
                {
                    name: "首页",
                    path: "/"
                },
                {
                    name: "设计资源",
                    path: '/designResources'
                },
                {
                    name: "封装资源",
                    path: "/encapsulationResources"
                },
                {
                    name: "球栅阵列",
                    path: "/encapsulationResourcesDetail"
                }
            ]


    }
    else if (window.location.pathname.includes('/encapsulationResources')) {
        breadcrumbList.value =
            [
                {
                    name: "首页",
                    path: "/"
                },
                {
                    name: "设计资源",
                    path: '/designResources'
                },
                {
                    name: "封装资源",
                    path: "/encapsulationResources"
                },
            ]
    }
    else if (window.location.pathname.includes('/designResources')) {
        breadcrumbList.value =
            [
                {
                    name: "首页",
                    path: "/"
                },
                {
                    name: "设计资源",
                    path: '/designResources'
                }]
    }

    console.log(window.location.href)
    console.log(window.location.pathname)

} catch (error) {
    console.log(error)
}


</script>
<style lang="scss" scoped>
li:last-child {
    img {
        display: none;
    }
}
</style>